package com.holyant.goods.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Objects;

/** 销售价查询dto
 * @author zgx *
 * @date 2022年09月14日 10:44
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalesPriceQueryDto implements Serializable {


    /** 渠道 */
    @NotNull(message = "渠道不能为空!")
    @ApiModelProperty(value = "渠道")
    private Integer salesChannel;

    @ApiModelProperty(name = "店铺id")
    private Long shopId;

    @ApiModelProperty(value = "skuId")
    private Long skuId;

    @ApiModelProperty(name = "客户id")
    private Long customerId;

    @NotNull(message = "报价类型不能为空!")
    @ApiModelProperty(value = "报价类型")
    private Integer quoteMethod;

    @NotNull(message = "币种不能为空!")
    @ApiModelProperty(value = "币种")
    private Integer curType;

    /** 生效日期 */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "生效日期")
    private LocalDate effectiveDate;

    public LocalDate getEffectiveDate() {
        return (Objects.isNull(effectiveDate))?LocalDate.now():effectiveDate;
    }

}
